repair corrupt (multi)polygons as far as possible. Fixes many clipping#908
repair corrupt (multi)polygons as far as possible. Fixes many clipping#908geoneutrino wants to merge 1 commit into
Conversation
|
Thanks! Really smart ideas in here - both the area guard and the zero-width buffer. I'm slightly nervous about imposing a 10% slowdown on everyone just because Maplibre Native can be a bit crashy on occasion (which I've also noticed) - Maplibre JS is more tolerant. So although I would very much like to merge something like this, I might play around with it a little more to see if we can ease the performance impact. My experience is that these errors mostly happen when geometries are simplified for lower zoom levels, which might help in targeting a little. On the examples you've cited, are these with tilemaker's out-of-the-box OMT config? |
|
Sorry, my text was maybe a bit inprecise. The hard raster/maplibre crash was only at the 2 locations mentioned Yes, its also in OMT config |
|
maybe its also good to know this finding / discussion |
|
And a thought on performance: it is not perfect to control program flow via parameters but it might be an option to introduce a new command line switch "repair extended (slower)" doing workload stuff but the default would stay on the current program flow ? |
This code tries to fix as many geometry errors, clipping and collapsing problems (geometry / parts missing in single tiles) as possible before writing to mbtiles
Area guard (50%) to prevent complete collapses
Buffer(0) for additional corrections (solves some intersections and topological errors)
Fixes:
Fixes nearly all clipping errors in complex geometries i knew about, e.g.
Can introduce an effect with spikes in non-correctable geometries but i have only seen this in Kaptai Lake area (which is with the fix much better than before)
Performance
depending on data used performance in my tests was in the region ~10% slower. To be expected when working heavily with geometries
But as correctness improves significant i think this is acceptable
(maybe i can have a deeper look at performance when i have time in the future)
Not solved / still open
With ocean shapes i still have few issues (saw this on an Philippines island and Denmark). Not repairable right now due todesign decisions in tilemaker - will open a discussion on this later this week
This code was written with help of AI. I'm mainly a C# developer so if a C++/boost guru sees potential feel free